﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.IO;

namespace DrugsShopManagement
{
    public partial class FrmAbout : DevExpress.XtraEditors.XtraForm
    {
        public FrmAbout()
        {
            InitializeComponent();
        }

        /// <summary>
        /// FrmAbout窗体加载txt内容
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmAbout_Load(object sender, EventArgs e)
        {
            String file = "";
            String[] files = Directory.GetFiles(Application.StartupPath + "..\\..\\..\\Text\\");
            foreach (String f in files)//查找根目录下txt后缀的文档
            {
                if (Path.GetFileNameWithoutExtension(f) == "frm_About_Update")
                {
                    file = f;//赋值给f
                    break;//跳出，否则是死循环
                }
            }
            //MessageBox.Show();
            FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default);
            this.txtUpdate.Text = sr.ReadToEnd();//textbox读取txt文档，并显示
            sr.Close();
            fs.Close();
        }
    }
}
